<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Best Sellers List</title>
</head>
<body>

<script language="JavaScript" type="text/javascript">
function getauction(auctionid)
{
  document.testform.auctionId.value = auctionid;
  document.testform.submit();
}
</script>

        <table border="0" cellpadding="0" cellspacing="0" style="width: 100%; height: 100%">
            <tr>
                <td style="vertical-align: top; width: 11237px; text-align: left; height: 454px;">
                    <p>Below is the best selller's list.</p>
                    <table border="8" id="PurchaseHistory">
                    <tr>
                      <td style="width: 187px">
                          <span style="font-size: 10pt">Item Name</span></td>
                        <td style="width: 74px">
                            <span style="font-size: 10pt">Number of Items Sold</span></td>
                    </tr>   
<% 
        
        String username = ""+session.getValue("login");
  			java.sql.Connection conn=null;
			try 
			{
            	Class.forName((String)session.getValue("mysJDBCDriver")).newInstance();
    			java.util.Properties sysprops=System.getProperties();
    			sysprops.put("user",(String)session.getValue("mysUserID"));
    			sysprops.put("password",(String)session.getValue("mysPassword"));
        
				//connect to the database
            			conn=java.sql.DriverManager.getConnection((String)session.getValue("mysURL"),sysprops);
            			System.out.println("Connected successfully to database using JConnect");
            
            			java.sql.Statement stmt1=conn.createStatement();
        
					java.sql.ResultSet rs = stmt1.executeQuery("select * from BestSellersList");
      	  
      	  int auctionID;
%>
      	  <form name="testform" method="get" action="AuctionInfo.jsp">
      	  <input type="hidden" name="auctionId"/>
<%
      	  while(rs.next())
        	{
%>			
                    <tr>
                      <td>
                          <span style="font-size: 10pt"><%=rs.getString(1)%></span></td>
                     <td>
                         <span style="font-size: 10pt"><%=rs.getInt(2)%></span></td>
                    </tr>
<%     		
        	}
  			} catch(Exception e)
			{
				e.printStackTrace();
				out.print(e.toString());
			}
			finally{
			
				try{conn.close();}catch(Exception ee){};
			}

  %>
  			</form>
  					</table>

</body>
</html>